package com.byt.consultation.api;


import com.byt.common.bean.ConsultaBean;
import com.byt.consultation.bean.BageNum;
import com.byt.consultation.bean.MainBanner;
import com.byt.netapi.ApiBase;
import com.byt.netapi.bean.ResponseBean;
import com.byt.netapi.observer.BaseObserver;

import java.util.List;
import java.util.Map;

public final class ConsultationApi extends ApiBase {
    private static volatile ConsultationApi instance = null;
    private ConsultationApiInterface mConsultationApiInterface;
    public static final String PAGE = "page";

    private ConsultationApi() {
        // ?per_page=20&staff_id=57729&info_id=4852&page=1
        super("");
        mConsultationApiInterface = retrofit.create(ConsultationApiInterface.class);
    }

    public static ConsultationApi getInstance() {
        if (instance == null) {
            synchronized (ConsultationApi.class) {
                if (instance == null) {
                    instance = new ConsultationApi();
                }
            }
        }
        return instance;
    }

    /**
     *  获取员工列表
     */
    public void getConsultList(BaseObserver<ResponseBean<List<ConsultaBean>>> observer, Map<String, Object> requestMap) {
        ApiSubscribe(mConsultationApiInterface.getConsultList(requestMap), observer);
    }

    /**
     * 获取咨询模块的广告
     * @param observer
     * @param requestMap
     */
    public void getMainBanner(BaseObserver<ResponseBean<List<MainBanner>>> observer, Map<String, Object> requestMap) {
        ApiSubscribe(mConsultationApiInterface.getMainBanner(requestMap), observer);
    }

    /**
     * 获取咨询模块的红点数字
     * @param observer
     * @param requestMap
     */
    public void getBageNum(BaseObserver<ResponseBean<BageNum>> observer, Map<String, Object> requestMap) {
        ApiSubscribe(mConsultationApiInterface.getBageNum(requestMap), observer);
    }
}
